﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pasys.PresentationCore;
using UIShell.OSGi;
using System.Windows.Forms;
using Pasys.PresentationCore.DockShell;
using Pasys.PresentationCore.DockShell.SmartPartInfos;
using DBExplorer.Generators;
using GeneratorLib.DB.Schemas;
using GeneratorLib.DB;

namespace DBExplorer
{

    public class TableFieldListProvider : GenetorBaseProvider<TableFieldList>
    {

    }

    public class TemplateGeneratorProvider : GenetorBaseProvider<TemplateGenerators.TemplateGenerator>
    {

    }


   /*
    public class TableFieldListProvider : AbstractViewProvider,IDisposable
    {

        //public static Type ControlType {
        //    get {
        //        return typeof(TableFieldList);
        //    }
        
        //}


        public TableFieldListProvider()
            : base(false)
        {
        }

     protected override Control CreateControl()
        {
            var c = BundleRuntime.Instance.GetFirstOrDefaultService<IConnection>();
            if (c != null)
            {
                BundleRuntime.Instance.RemoveService<IConnection>(c);
            }

            var t =(TableInfo) BundleRuntime.Instance.GetFirstOrDefaultService<ITableInfo>();
            if (t != null)
            {
                BundleRuntime.Instance.RemoveService<ITableInfo>(t);
            }

            var f = new TableFieldList()
            {
                Connection =c,
                Table=t
            };
            return f;
        }

        protected override ISmartPartInfo CreateViewInfo()
        {
            //Assembly assembly = Assembly.GetExecutingAssembly();
            //System.Drawing.Icon icon = null;

            //using (var stream = assembly.GetManifestResourceStream("DBExplorer.Resources.Hyperlink16.png"))
            //{                
            //    icon = new System.Drawing.Icon (stream, 16, 16);
            //}

            return new DockPanelSmartPartInfo()
            {
                //Icon = icon,
                DockingType = DockingType.Document,
                ShowStrategy= new DockStateShowStrategy(DockState.Document)
            };
        }

        public void Dispose()
        {
            if (SingleView != null)
            {
                SingleView.Dispose();
                SingleView = null;
            }
        }
    }
    */

}
